package com.bdqn.ch01.Sl;

import java.io.IOException;
import java.io.Serializable;

/**
 * Person
 *
 * @aurhor Administrator  whs
 * @since 2024/6/26
 */
public final class Person extends BaseClass implements Serializable {

    //成员变量
    private String name;
    static int age = 30 ;
    protected String address ;
    public String massage;

    // 成员方法
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    protected String getAddress() {
        return address;
    }

    public static final int getAge(){
        return age;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getMassage() {
        return massage;
    }

    public void setMassage(String massage) {
        this.massage = massage;
    }

    private void silentMethod() throws IOException , NullPointerException{
        System.out.printf("这是悄悄话");
    }


    // 以下声明用于通过反射获取构造方法信息测试
    public Person(){

    }
    private Person(String name){
        this.name = name;
    }
    protected Person(String name,String address,String massage ){
        this.name = name;
        this.address = address;
        this.massage = massage;

    }

    /**
     * 重写toString 方法
     * @return
     */
    @Override
    public String toString() {
        return "{name: "+name+ ", address: "+address+", massage: "+massage+", age: "+age+"}";
    }

}
